//
//  SecondLevelMenuViewController.m
//  ShoppingExperience
//
//  Created by LiYinDi on 14-12-30.
//  Copyright (c) 2014年 RuiBen. All rights reserved.
//

#import "SecondLevelViewController.h"
#import "SecondLevelTableViewCell.h"
//#import "ShopCartViewController.h"
//#import "SignInViewController.h"
#import "Global.h"
@interface SecondLevelViewController ()
{
    NSArray *shopGuideIconImageArray;
    NSArray *shopGuideTextArray;
    
    NSArray *productIconImageArray;
    NSArray *productTextArray;
    
    NSArray *stockIconImageArray;
    NSArray *stockTextArray;
    
    NSArray *factoryIconImageArray;
    NSArray *factoryTextArray;
    
    NSArray *analysisIconImageArray;
    NSArray *analysisTextArray;
    
    NSArray *shopAffairIconImageArray;
    NSArray *shopAffairTextArray;
    
//    NSArray *myAccountIconImageArray;
//    NSArray *myAccountTextArray;
    
    NSArray *viewControllers;
    
}
@end

@implementation SecondLevelViewController
-(void)viewWillAppear:(BOOL)animated
{
    [_secondLevelTableView setBackgroundColor:[UIColor clearColor]];
    [_alphaView setBackgroundColor:[Global parseColor:WESTORE_TRANSCLUCENT]];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    shopGuideIconImageArray=[NSArray arrayWithObjects:@"huiyuan_.png",@"gouwuche_.png",@"dingdang_.png",@"earnestmoney_.png",@"fuwu_.png",@"tuihuanhuo_.png", nil];
    shopGuideTextArray=[NSArray arrayWithObjects:@"会员",@"购物车",@"订单",@"定金",@"服务",@"退货",nil];
    
    productIconImageArray=[NSArray arrayWithObjects:@"xiliechangpin_.png",@"huangjin_.png",@"bojin_.png",@"Kjin_.png",@"zuanshi_.png",@"feicui_.png",@"caibao_.png",@"zhenzhu_.png",@"yinshi_.png", @"qita_.png",nil];
    productTextArray=[NSArray arrayWithObjects:@"系列产品",@"黄金",@"铂金",@"K金",@"钻石",@"翡翠",@"彩宝",@"珍珠",@"银饰",@"其他",nil];

//    stockIconImageArray=[NSArray arrayWithObjects:@"kucunchaxun_.png",@"yangpinchenlie_.png",@"diaobochuku_.png",@"yaohuoguanli_.png",@"daohuoguanli_.png",@"pandian_.png",@"jiujinguanli_.png", @"biaoqiandayin_.png",nil];
    stockIconImageArray=[NSArray arrayWithObjects:@"kucunchaxun_.png",@"yangpinchenlie_.png",@"diaobochuku_.png",@"daohuoguanli_.png",@"pandian_.png",@"jiujinguanli_.png", @"biaoqiandayin_.png",nil];
//    stockTextArray=[NSArray arrayWithObjects:@"库存查询",@"产品陈列",@"调拨出库",@"要货管理",@"到货管理",@"盘点管理",@"旧金管理",@"标签打印",nil];
//    stockTextArray=[NSArray arrayWithObjects:@"库存查询",@"产品陈列",@"调拨出库",@"要货管理",@"到货管理",@"盘点管理",@"旧金管理",nil];
    stockTextArray=[NSArray arrayWithObjects:@"库存查询",@"产品陈列",@"调拨出库",@"到货管理",@"盘点管理",@"旧金管理",nil];
    factoryIconImageArray=[NSArray arrayWithObjects:@"zixun_.png",@"huodong_.png",@"shipin_.png",nil];
    factoryTextArray=[NSArray arrayWithObjects:@"资讯",@"活动",@"视频",nil];
    
    analysisIconImageArray=[NSArray arrayWithObjects:@"kucunfenxi_.png",@"huiyuanfenxi_.png",@"xiaoshoufenxi_.png",nil];
    analysisTextArray=[NSArray arrayWithObjects:@"库存分析",@"会员分析",@"销售分析",nil];
    
    
    shopAffairIconImageArray=[NSArray arrayWithObjects:@"zhanghuzhongxin_.png",@"daogouguanli_.png",@"xiaoxizhongxin_.png",@"xiaoxizhongxin_.png",@"guanyu_.png",@"fankui_.png", nil];
    shopAffairTextArray=[NSArray arrayWithObjects:@"账户中心",@"导购中心",@"消息中心",@"设置中心 ",nil];
    
   
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(Actiondo)];
    [_alphaView addGestureRecognizer:tapGesture];
    // Do any additional setup after loading the view from its nib.
   // NSMutableArray *addShopGuideControllers=[[NSMutableArray alloc] init];
   
//    shopCartVC=[[ShopCartViewController alloc] init];
//    shopCartVC.delegate=self;
//    [addShopGuideControllers addObject:shopCartVC];
//    signInVC=[[SignInViewController alloc] init];
//    [addShopGuideControllers addObject:signInVC];
//    
//    viewControllers=[NSArray arrayWithArray:addShopGuideControllers];
    
}
-(void)Actiondo
{
    if ([self.delegate respondsToSelector:@selector(alphaViewClick)]) {
            [self.delegate alphaViewClick];
       }
}
//-(void)backClick
//{
//    // _viewContainer.hidden=NO;
//    UIViewController *previousViewController = [viewControllers objectAtIndex:0];
//    [previousViewController.view removeFromSuperview];
//    [previousViewController removeFromParentViewController];
//}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 80.0f;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return _cellCount;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString * const SecondLevelTableViewCellIdentifier = @"SecondLevelTableViewCell";
    SecondLevelTableViewCell *cell=(SecondLevelTableViewCell *)[tableView dequeueReusableCellWithIdentifier:SecondLevelTableViewCellIdentifier];
    if (cell==nil) {
        NSArray *array = [[NSBundle mainBundle] loadNibNamed:@"SecondLevelTableViewCell" owner:self options:nil];
        cell = [array objectAtIndex:0];
        }
    [cell setBackgroundColor:[UIColor clearColor]];
    if ([_tableID isEqualToString:@"SHOPGUIDE"]) {
    [cell.iconImageView setImage:[UIImage imageNamed:[shopGuideIconImageArray objectAtIndex:indexPath.row]]];
    [cell.contentLabel setText:[shopGuideTextArray objectAtIndex:indexPath.row]];
        
    }
    else if ([_tableID isEqualToString:@"PRODUCT"]) {
        [cell.iconImageView setImage:[UIImage imageNamed:[productIconImageArray objectAtIndex:indexPath.row]]];
        [cell.contentLabel setText:[productTextArray objectAtIndex:indexPath.row]];
        
    }
    else if ([_tableID isEqualToString:@"STOCK"]) {
        [cell.iconImageView setImage:[UIImage imageNamed:[stockIconImageArray objectAtIndex:indexPath.row]]];
        [cell.contentLabel setText:[stockTextArray objectAtIndex:indexPath.row]];
        
    }
    else if ([_tableID isEqualToString:@"FACTORY"]) {
        [cell.iconImageView setImage:[UIImage imageNamed:[factoryIconImageArray objectAtIndex:indexPath.row]]];
        [cell.contentLabel setText:[factoryTextArray objectAtIndex:indexPath.row]];
        
    }
    else if ([_tableID isEqualToString:@"ANALYSIS"]) {
        [cell.iconImageView setImage:[UIImage imageNamed:[analysisIconImageArray objectAtIndex:indexPath.row]]];
        [cell.contentLabel setText:[analysisTextArray objectAtIndex:indexPath.row]];
        
    }


    else if ([_tableID isEqualToString:@"SHOPAFFAIR"]) {
        [cell.iconImageView setImage:[UIImage imageNamed:[shopAffairIconImageArray objectAtIndex:indexPath.row]]];
        [cell.contentLabel setText:[shopAffairTextArray objectAtIndex:indexPath.row]];
        
    }
    
    return cell;
    
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if ([self.delegate respondsToSelector:@selector(tableCellClick:)]) {
        [self.delegate tableCellClick:indexPath.row];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
